package com.devilvan.sort;

public class YouGetSort1024 {
    // 冒泡排序
    public int[] bubbleSort(int[] nums){
        // 9 7 0 -1 2 17 5
        // 0 7 -1 2 5 9 17
        for (int i = 0;i < nums.length;i++){
            for (int j = 0;j < nums.length - i - 1;j++ ){
                // 交换
                if (nums[j+1] < nums[j]){
                    int temp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = temp;
                }
            }
        }
        return nums;
    }
}
